Skip to content

Fix CI: drop libglapi-mesa and require numpy 2 in the minimal environment - #1597

Merged
pgunn merged 2 commits into
flatironinstitute:devfrom
eeshaanjum:ci-drop-libglapi
Nov 14, 2026
Merged

pgunn merged 2 commits into
flatironinstitute:devfrom
eeshaanjum:ci-drop-libglapi

Conversation

@eeshaanjum

Copy link
Copy Markdown

Description

CI has been failing on every PR since late October. I found two separate causes, and this fixes both.

  1. ubuntu-latest is now Ubuntu 26.04, and libglapi-mesa is no longer packaged there (it was dropped after 24.04). The apt step fails before anything else runs. The other three packages on that line still exist, so I only removed that one.

  2. With that fixed, Python 3.11 fails in "Install Dependencies". Conda picks numpy 1.26.4 and scikit-image 0.20.0, along with ml_dtypes 0.6.0 (pulled in by keras), which declares numpy>=2. pip install -e . sees that and replaces numpy with 2.4.6, and scikit-image then fails to import with "numpy.dtype size changed, may indicate binary incompatibility". Asking for numpy >=2 in environment-minimal.yml makes conda pick a consistent set (numpy 2.4.6 and scikit-image 0.25.2 in a dry-run solve), and pip leaves it alone.

The second change means the minimal environment no longer installs numpy 1.x. If you'd rather keep that possible, the alternative is to stop pip touching conda's packages in the workflow (pip install --no-deps -e .). I'm happy to switch to that. I left environment.yml alone.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Branching

Targets dev.

Has your PR been tested?

I ran the workflow on my fork with these two commits and all three jobs passed (3.9, 3.10 and 3.11): https://github.com/eeshaanjum/CaImAn/actions/runs/43229326476

With only the first commit, 3.9 and 3.10 passed and 3.11 failed as described above.

@pgunn

pgunn commented Nov 14, 2026

Copy link
Copy Markdown
Member

I think @kushalkolar (or was it @ethanbb ?) didn't want us to lose Numpy 1.x compatibility; I've forgotten the details (and even the when) of the conversation. Personally my leaning was to go all-on on Numpy 2, but I deferred on that discussion.

I don't know why pip would change the numpy version to 2.x unless sklearn, skimage, or numpydoc tries to pull it up; the install process is honestly a bit of a mess. In an ideal world the pip step for pip install . would do something different if we're trying to do a pure source install versus an install based on a prepared conda environment (in the latter we'd want it to not change or install anything but caiman).

I had imagined we could sort all this stuff out while splitting caiman into a library portion and a few frontend packages; at that time we'd have to redo packaging from the ground up and would be breaking legacy usage either way; it'd be the perfect time for making it all perfect. I now (with my new job) struggle to find the time.

If ethan or kushal remembers why we were trying to keep numpy 1.x compatibility we can make those further changes you mention to mantain it; otherwise IMO we may as well change the environment yml and pyproject pins to make sure it always goes with numpy 2. In the long run numpy 1.x is going to fade from memory/concern and I don't think it makes sense to worry about compatibility with it (although I am willing to be convinced otherwise).

(I'll circle back in a week)

@ethanbb

ethanbb commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Hi hello, it was me (discussed in #1549). My concern wasn't necessarily that we should keep supporting numpy 1.x indefinitely - I'm fully on 2.x versions now in my environments. I just wanted to keep using compatible interfaces and avoid behavior changes during the transition to make it easier to isolate anything causing tests to fail (specifically I was trying to tease out the causes of several test failures and get back to green in mesmerise-core, which depends heavily on caiman).

I'm not opposed to requiring 2.x now if we actually need it... That being said, this is really a package manager issue, not a problem with our requirements. To me, it's more mysterious why numpy 1 gets installed initially - maybe it's related to scikit-image? But yeah, the conda followed by pip install method is frustratingly unreliable in general.

One solution could be to use pip install --no-deps if you're sure the dependencies have already been installed, although if there are any pip-only dependencies that probably won't work because they will need their dependencies, etc. You can also conda install the version of numpy that pip is going to pull ahead of time to fix this specific issue. But other problems like this could crop up any time.

Instead of all this, I started using pixi to manage my environments, including a local caiman version (using pixi-build). I hesitate to recommend it for everyone, because it's opinionated and quirky in its own ways - for example, it insists on re-building the extension module(s) (oasis) whenever the environment changes. It kind of amortizes the pain of setting up the environment over all the times you activate the environment, but in return you get confidence that the environment can be replicated somewhere else from the environment file (pixi.toml) at any given time. And it does seem to manage versions between conda and pypi packages pretty well. I'm happy to give more details if that sounds interesting.

@pgunn

pgunn commented Nov 14, 2026

Copy link
Copy Markdown
Member

Ah, that's fair. Sorry for forgetting the context. I think whenever the project gets a new primary maintainer, figuring out dependencies, reevaluating whether conda should be the golden path, and splitting the codebases will be high priorities.

Do you have a leaning as to how long and how we should support the transition to numpy 2.x? I am relatively unopinionated on the topic, but I do want to fix CI very soon (this weekend or next) so we can unblock taking PRs again, and ideally so I can cut a new release.

@pgunn

pgunn commented Nov 14, 2026

Copy link
Copy Markdown
Member

I think for now I don't want to complicate the install requirements; no-deps doesn't feel great. I'm inclined to accept this PR which should fix the issue (may need to prod existing PR submitters to rebase, I think) and not touch anything else. We can figure out numpy 1.x vs 2.x later, I guess.

@pgunn
pgunn merged commit 99d6bf0 into flatironinstitute:dev Nov 14, 2026
3 checks passed
@pgunn

pgunn commented Nov 14, 2026

Copy link
Copy Markdown
Member

Thanks eesha! I was going to spend some time on this this weekend and it's very nice to see it already done. Software packaging stuff isn't a lot of fun.

@ethanbb

ethanbb commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

I'm fine with this as a practical fix for the conda/pip dysfunction. I wasn't thinking of this as "supporting" the transition so much as not forcing an upgrade when our code doesn't depend on it, in the interest of theoretically making more combinations of packages possible. I'm still perplexed why conda seemingly creates a problem here by pulling numpy 1 when we're not requesting it or doing anything except not pinning a version; imo not pinning should be the default and "just work," but obviously the tools aren't perfect. I suspect the root cause has nothing to do with caiman.

@pgunn

pgunn commented Nov 14, 2026

Copy link
Copy Markdown
Member

I agree with that, and am likewise puzzled. Although in terms of simplifying our code I'm happy to pull up the ladder on old versions of dependencies on a regular basis. Doing it too quickly can cause problems though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants